package com.sailing.study.hash;

import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;

import java.nio.charset.Charset;

public class CCBloomFilter {

    static int size = 10000000;
    static BloomFilter bloomFilter = BloomFilter.create(Funnels.stringFunnel(Charset.forName("utf8")),size);

    static {
        System.out.println("load start: " + System.currentTimeMillis());
        for(int i=0; i<size; i++){
            bloomFilter.put("bloomfilter"+i);
        }
        System.out.println("load finish: " + System.currentTimeMillis());
    }
    public static void main(String[] args) {
        System.out.println(bloomFilter.mightContain("bloomfilter1"));
    }

}
